{template 'common/header'}
<!--小程序前端下载-->
{if $do != 'custom'}
	{if $_W['account']['type_sign'] != 'wxapp'}
	<ul class="we7-page-tab">
		<li class="{if $do == 'front_download'}active{/if}">
			<a href="{php echo url('wxapp/front-download/', array('version_id' => $version_id));}">{$account_all_type[$_W['account']['type']]['title']}下载</a>
		</li>
	</ul>
	{else}
	<ul class="we7-page-tab">
		{if ACCOUNT_TYPE_APP_AUTH == $_W['account']['type']}
		<li class="{if $do == 'platform_version_manage'}active{/if}">
			<a href="{php echo url('wxapp/front-download/platform_version_manage', array('version_id' => $version_id));}">版本管理</a>
		</li>
		<li class="{if $do == 'auth_domain_list'}active{/if}">
			<a href="{php echo url('wxapp/front-download/auth_domain_list', array('version_id' => $version_id));}">业务域名管理</a>
		</li>
		{/if}
		<li class="{if $do == 'front_download'}active{/if}">
			<a href="{php echo url('wxapp/front-download/front_download', array('version_id' => $version_id));}">授权上传</a>
		</li>
		<li class="{if $do == 'tominiprogram'}active{/if}">
			<a href="{php echo url('wxapp/front-download/tominiprogram', array('version_id' => $version_id))}">可跳转小程序设置</a>
		</li>
		
	</ul>
	{/if}
{else}
<ol class="breadcrumb" style="background-color: transparent;">
	<a href="{php echo url('wxapp/front-download/front_download', array('version_id' => $version_id));}">
		<i class="wi wi-back-circle color-gray" style="font-size: 30px;position: relative;top: 5px;"></i>
	</a>
	<li><a href="{php echo url('wxapp/front-download/front_download', array('version_id' => $version_id));}">小程序上传</a></li>
	<li class="active">定制主题</li>
</ol>
{/if}

<!--小程序入口-->
{if $do == 'entrychoose'}
<div class="panel we7-panel">
	<div class="panel-heading">小程序入口配置</div>
	<div class="panel-body ">
		<table class="table we7-table table-hover" >
			<tr>
				<th>标题</th>
				<th>url</th>
				<th>操作</th>
			</tr>
			{loop $entrys $entry}
			<tr>
				<td>{$entry['title']}</td>
				<td>{$entry['url']}</td>
				<td><button class="btn btn-primary js-entry-btn" data-eid="{$entry['eid']}" {if $entry['eid'] == $version_info['entry_id']} disabled {/if} >设为入口</button></td>
			</tr>
			{/loop}
		</table>
	</div>
</div>
<script type="text/javascript">
	var entry_url = "{php echo url('wxapp/front-download/set_wxapp_entry', array('version_id'=>$version_id))}";
	$('.js-entry-btn').click(function(){
		var entry_id = $(this).data('eid');
		$.post(entry_url, {'entry_id':entry_id}, function(data){
			if(data.errno == '0') {
				util.message('设置成功');
			}
			window.location.reload();
		})
	});
</script>
{/if}

<!--小程序自定样式-->
{if $do == 'custom'}
<div ng-controller="code_appjson_ctrl" id="codeappjson" ng-controller="codeAppjsonCtrl">
	<div class="panel we7-panel wxapp-upload-setting">
		<div class="panel-heading">顶部导航栏设置</div>
		<div class="panel-body">
			<div class="we7-flex">
				<div class="view-img"><img src="/web/resource/images/wxapp/setting-01.png" alt=""></div>
				<div class="form-horizontal">
					<div class="form-group">
						<label class="col-xs-3 control-label">小程序标题</label>
						<div class="col-xs-9">
							<input type="text" required="required" ng-model="window.navigationBarTitleText"
								   placeholder="小程序标题" class="form-control">
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-3 control-label">标题颜色</label>
						<div class="col-xs-9">
							<select ng-model="window.navigationBarTextStyle">
								<option value="white">白</option>
								<option value="black">黑</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-3 control-label">导航背景颜色</label>
						<div class="col-xs-9">
							<input type="text" placeholder="小程序导航背景颜色" ng-model="window.navigationBarBackgroundColor" class="form-control js-color">
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-3 control-label">小程序背景色</label>
						<div class="col-xs-9">
							<input type="text" placeholder="小程序背景色" ng-model="window.backgroundColor" class="form-control js-color">
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="panel we7-panel wxapp-upload-setting">
		<div class="panel-heading">底部导航栏设置</div>
		<div class="panel-body">
			<div class="we7-flex">
				<div class="view-img"><img src="/web/resource/images/wxapp/setting-02.png" alt=""></div>
				<div class="form-horizontal">
					<div class="form-group">
						<label class="col-xs-3 control-label">文字默认颜色</label>
						<div class="col-xs-9">
							<input type="text" placeholder="文字默认颜色" ng-model="tabBar.color" class="form-control js-color">
						</div>
					</div>

					<div class="form-group">
						<label class="col-xs-3 control-label">文字选中颜色</label>
						<div class="col-xs-9">
							<input type="text" placeholder="文字默认颜色" ng-model="tabBar.selectedColor" class="form-control js-color">
						</div>
					</div>

					<div class="form-group">
						<label class="col-xs-3 control-label">底部导航颜色</label>
						<div class="col-xs-9">
							<input type="text" placeholder="底部导航颜色" ng-model="tabBar.backgroundColor" class="form-control js-color">
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-3 control-label">交界线颜色</label>
						<div class="col-xs-9">
							<select ng-model="tabBar.borderStyle">
								<option value="white">白</option>
								<option value="black">黑</option>
							</select>
						</div>
					</div>

					<div class="form-group hidden">
						<label class="col-xs-3 control-label">tab类型</label>
						<div class="col-xs-9">
							<select ng-model="tabBar.isSystemTabBar">
								<option value="1">系统</option>
								<option value="0">开发者自定义</option>
							</select>
						</div>
					</div>
					<table class="table we7-table hidden">
						<col width="75px">
						<col width="75px">
						<col width="90px">
						<col width="60px">
						<col width="60px">
						<col width="100px">
						<tr>
							<th>默认</th>
							<th>选中</th>
							<th>菜单名称</th>
							<th class="text-center">跳转</th>
							<th>操作</th>
						</tr>
						<tbody ng-repeat="tabitem in tabBar.list" ng-init="current = $index">
						<tr >
							<td>
								<div class="icon js-image"  data-index="{{current}}" data-selected="0">
									<img ng-src="{{iconPath(tabitem)}}" />
									<span class="replace ">更换</span>
								</div>
							</td>
							<td>
								<div class="icon js-image" data-index="{{current}}" data-selected="1">
									<img ng-src="{{tabitem.selectedIconPath}}" />
									<span class="replace " >更换</span>
								</div>
							</td>
							<td>
								<input type="text" class="form-control" value="首页" ng-model="tabitem.text">
							</td>
							<td>
								<div>
									<select ng-model="tabitem.pagePath" ng-options="x for x in pages" style="width:100px;"></select>
								</div>
							</td>
							<td>
								<button class="btn btn-primary" ng-click="del($index)">删除</button>
							</td>
						</tr>
						</tbody>
						<tfoot>
							<button class="btn btn-primary hidden" ng-click="add()">添加</button>
						</tfoot>
					</table>
				</div>
			</div>
		</div>
	</div>
	<div class="help-block">说明:点击保存则以当前设置的主题为准,如未保存,则以小程序应用内的设置为准. </div>
	<button class="btn btn-primary" ng-click="default()">恢复默认</button>
	<button class="btn btn-primary" ng-click="save()">保存</button>
</div>
<script type="text/javascript">
	angular.module('we7codeAppjsonApp').value('config',{
		'version_id' : {$version_id},
		'default_appjson' : '{$default_appjson}',
		'save_url' : "{php echo url('wxapp/front-download/custom_save')}",
		'default_url' : "{php echo url('wxapp/front-download/custom_default')}",
		'convert_img_url' : "{php echo url('wxapp/front-download/custom_convert_img')}"
	});
	angular.bootstrap($('#codeappjson'), ['we7codeAppjsonApp']);
</script>
{/if}

{if $do == 'front_download'}
	{if $_W['account']['type_sign'] != WXAPP_TYPE_SIGN}
	<div class="front-download" id="other-upload" ng-controller="otherapp_upload_ctrl" ng-cloak>
		{if $_W['account']['type_sign'] != ALIAPP_TYPE_SIGN}
		<div class="alert we7-page-alert">
			<p>
				<i class="wi wi-info-sign"></i>
				下载{$account_all_type[$_W['account']['type']]['title']}模块zip包, 然后用{$account_all_type[$_W['account']['type']]['title']}开发者工具上传开发版本
			</p>
			<p>
				<i class="wi wi-info-sign"></i>
				{$account_all_type[$_W['account']['type']]['title']}开发者工具下载链接：
				{if $_W['account']['type_sign'] == BAIDUAPP_TYPE_SIGN}
				<a href="javascript:openUrl('https://smartprogram.baidu.com/docs/develop/devtools/show_sur')">https://smartprogram.baidu.com/docs/develop/devtools/show_sur/</a>
				{elseif $_W['account']['type_sign'] == TOUTIAOAPP_TYPE_SIGN}
				<a href="javascript:openUrl('https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/developer-instrument/developer-instrument-update-and-download')">https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/developer-instrument/developer-instrument-update-and-download</a>
				{/if}
			</p>
		</div>
		{else}
		<div class="alert we7-page-alert">
			<p><i class="wi wi-info-sign"></i>小程序上传代码配置：登录<a href="javascript:openUrl('https://auth.alipay.com/login/ant_sso_index.htm?goto=https%3A%2F%2Fopen.alipay.com%2Fplatform%2FdeveloperIndex.htm')">开放平台</a> 右上角账户中心->密钥管理->开发工具密钥->生成身份密钥 进行下载。</p>
		</div>
		<div>
			<div class="form-files-box">
				<div class="form-file">
					<div class="form-label">小程序上传密钥</div>
					<div class="form-value">{if $_W['account']['upload_private_key'] != ''}已设置{else}未设置{/if}</div>
					<div class="form-edit">
						<a class="javascript:;" data-toggle="modal" data-target="#privatekey-tools-modal">修改</a>
					</div>
				</div>
			</div>
		</div>
		<!--小程序配置弹框-->
		<div class="modal fade " tabindex="-1" role="dialog" id="privatekey-tools-modal">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header clearfix">
						小程序上传配置
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					</div>
					<div class="modal-body we7-form">
						<div class="form-group">
							<label class="col-sm-2 control-label">工具ID</label>
							<div class="col-sm-10">
								<input type="text" ng-model="tool_id" class="form-control" placeholder="工具ID">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">上传秘钥</label>
							<div class="col-sm-10">
								<textarea ng-model="privatekey" name="privatekey" class="form-control" placeholder="请到支付宝后台生成秘钥后配置秘钥"></textarea>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" value="保存" ng-click="updatePrivateKey()">保存</button>
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>
		{/if}
		<div class="app-down-box">
			<img src="{if !empty($module['logo'])}{$module['logo']}{/if}" alt="{if !empty($module['title'])}{$module['title']}{/if}" class="logo">
			<div class="title">{if !empty($module['title'])}{$module['title']}{/if}{$account_all_type[$_W['account']['type']]['title']}zip包</div>
			{if in_array($_W['account']['type_sign'], array(BAIDUAPP_TYPE_SIGN, TOUTIAOAPP_TYPE_SIGN))}
			<a class="btn btn-primary" href="{php echo url('wxapp/front-download/getpackage', array('version_id' => $version_id))}">
				立即下载
			</a>
			{/if}
			{if ALIAPP_TYPE_SIGN == $_W['account']['type_sign']}
			<div class="media-right media-middle">
				<a href="javascript:;" class="btn btn-primary" ng-click="resetUpload()">授权上传</a>
			</div>
			<!--上传弹框-->
			<div class="modal fade in" tabindex="-1" role="dialog" aria-hidden="false" id="upload-otherapp-modal">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
							<div class="modal-title">小程序上传</div>
						</div>
						<div class="modal-body overflow-auto">
							<div class="modal-body we7-form wxapp-examine-self">
								<div class="panel-body">
									<div class="step we7-flex" style="padding: 0px;">
										<div class="one active">
											<span class="wi wi-one"></span>设置参数
										</div>
										<div class="arrow">
											<span class="wi wi-step-arrows"></span>
										</div>
										<div class="two" ng-class="{true:'active',false:''}[step>=2]">
											<span class="wi wi-two"></span>上传
										</div>
									</div>
								</div>
							</div>

							<div ng-show="show_step1">
								<form action="" class="we7-form" id="codeform" ng-init="user_version = '{$user_version}'; user_desc = '{$version_info['description']}'">
									<input type="hidden" name="ticket" id="ticket">
									<input type="hidden" id="version_id" value="{$version_id}">
									<div class="form-group">
										<label class="control-label col-sm-2">版本号</label>
										<div class="col-sm-10">
											<input type="text" class="form-control" id="user_version" ng-model="user_version" value="" placeholder="如：1.2.3">
											<span class="help-block">版本号仅限数字</span>
										</div>
									</div>
								</form>
							</div>
							<div class="wxapp-examine-self" ng-show="show_step2">
								<script type="text/javascript" src="../../../web/resource/js/lib/jquery.qrcode.min.js "></script>
								<div class="success text-center step3">
									<div ng-show="uploadState == 0">
										<span class="help-block text-center"><img src="./resource/images/loading.gif" alt="" width="45px"></span>
										<div class="status-state" style="margin-top: 10px">小程序正在上传中</div>
										<div class="help-block" style="margin-top: 30px">{{progress}}</div>
										<div class="help-block">上传过程中请勿关闭弹框</div>
									</div>
									<div ng-show="uploadState == 1">
										<div id="qrcode"></div>
										<div class="help-block">请扫描二维码进行预览</div>
										<div class="status-state">上传代码成功，请到支付宝小程序后台提交审核</div>
										<a href="javascript:openUrl('https://open.alipay.com');" style="color: #3296fa;">支付宝小程序后台：https://open.alipay.com</a>
										<div class="btns">
											<a class="btn btn-primary" href="javascript:openUrl('https://open.alipay.com');">去提交审核</a>
										</div>
									</div>
									<div ng-show="uploadState == 2">
										<i class="wi wi-warning-cricle" style="color: #c7254e;"></i>
										<div class="tip">小程序上传失败</div>
										<div class="we7-help-block" style="margin-top: 30px">{{reason}}</div>
										<div class="btns">
											<button type="button" class="btn btn-default" data-dismiss="modal">关 闭</button>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="modal-footer">
							<div ng-show="show_step1">
								<button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
								<button class="btn btn-primary" type="button" id="begin-upload" ng-click="beforeUpload({$version_info['support_live']})">确定并继续</button>
							</div>
						</div>
					</div>
				</div>
			</div>
			{/if}
		</div>
	</div>
	<script>
		angular.module('we7codeuploadApp').value('config',{
			canUpload: "{$account['type']}",
			appUrl: "{$appurl}",
			privatekey: {php echo !empty($privatekey) ? json_encode($privatekey) : 'null'},
			accountType: "{$account['type']}",
			version_id: "{$version_id}",
			upgrade_url: "{php echo url('wxapp/front-download/upgrade_module')}",
			links: {
				setPrivateKey: "{php echo url('wxapp/front-download/upload_private_key')}",
			}
		});

		angular.bootstrap($('#other-upload'), ['we7codeuploadApp']);
	</script>
	{else}
	<ul class="timeline-list" id="wxapp-upload" ng-controller="wxapp_upload_ctrl" ng-cloak>
		<li class="timeline-item">
			<div class="timeline-item_tail"></div>
			<div class="timeline-item_node">1</div>
			<div class="timeline-item_wrapper">
				<div class="timeline-item_timestamp">
					上传前配置项
				</div>
				<div class="timeline-item_content">
					<div class="tbox">
						<div class="alert we7-page-alert">
							<p><i class="wi wi-info-sign"></i>请确认上传前配置项设置完成以后，再进行上传。</p>
						</div>
						{if ACCOUNT_TYPE_APP_AUTH != $_W['account']['type']}
						<table class="table we7-table table-hover table-form">
							<col width="140px " />
							<col />
							<col width="100px" />
							<tr><th class="text-left" colspan="3">小程序密钥</th></tr>
							<tr>
								<td class="table-label">上传密钥</td>
								<td>{if $_W['account']['upload_private_key'] != ''}已设置{else}未设置{/if}</td>
								<td><div class="link-group"><a href="javascript:;" data-toggle="modal" data-target="#privatekey-modal">修改</a></div></td>
							</tr>
						</table>
						{/if}
						<table class="table we7-table table-hover table-form">
							<col width="140px " />
							<col />
							<col width="100px" />
							<tr>
								<th class="text-left" colspan="3">
									小程序配置
									{if $_W['isadmin']}
									<a href="javascript:openUrl('https://wiki.w7.com/document/1703/8195');" class="pull-right"data-toggle="tooltip" data-placement="bottom" title="" data-original-title="具体说明请点我查看详情">查看文档&nbsp;<i class="wi wi-bangzhu"></i></a>
									{/if}
								</th>
							</tr>
							<tr>
								<td class="table-label">小程序URL</td>
								<td ng-bind="appUrl"></td>
								<td>
									<div class="link-group">
										<a href="javascript:;" data-toggle="modal" data-target="#appurl-modal">修改</a>
									</div>
								</td>
							</tr>
							<tr>
								<td class="table-label">校验文件</td>
								<td ng-bind="verifyTxtFile"></td>
								<td>
									<div class="link-group">
										<a href="javascript:;" data-toggle="modal" data-target="#upload-txt-modal">上传</a>
									</div>
								</td>
							</tr>
						</table>
						<!--小程序密钥弹框-->
						<div class="modal fade " tabindex="-1" role="dialog" id="privatekey-modal">
							<div class="modal-dialog" role="document">
								<div class="modal-content">
									<div class="modal-header clearfix">
										设置小程序密钥
										<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
									</div>
									<div class="modal-body we7-form">
										<div class="form-group">
											<label class="col-sm-2 control-label">上传秘钥</label>
											<div class="col-sm-10">
												<textarea ng-model="privatekey" name="privatekey" class="form-control" placeholder="访问【微信公众平台-开发管理-开发设置-小程序代码上传密钥】后下载代码上传秘钥"></textarea>
												<span class="help-block">一定要关闭“IP白名单”或配置“IP白名单”，否则无效。</span>
											</div>
										</div>
									</div>
									<div class="modal-footer">
										<button type="button" class="btn btn-primary" value="保存" ng-click="updatePrivateKey()">保存</button>
										<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
									</div>
								</div>
							</div>
						</div>
						<!--小程序URL弹框-->
						<div class="modal fade " tabindex="-1" role="dialog" id="appurl-modal">
							<div class="modal-dialog" role="document">
								<div class="modal-content">
									<div class="modal-header clearfix">
										设置小程序URL
										<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
									</div>
									<div class="modal-body we7-form">
										<div class="form-group">
											<label class="col-sm-2 control-label">小程序URL</label>
											<div class="col-sm-10">
												<input type="text" ng-model="appUrl" class="form-control">
												<span class="help-block">示例：https://域名/app/index.php</span>
											</div>
										</div>
									</div>
									<div class="modal-footer">
										<button type="button" class="btn btn-primary" value="保存" ng-click="updateAppUrl()">保存</button>
										<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
									</div>
								</div>
							</div>
						</div>
						<!--校验文件弹框-->
						<div class="modal fade" id="upload-txt-modal" tabindex="-1" role="dialog" aria-hidden="true">
							<div class="we7-modal-dialog modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
										<div class="modal-title">校验文件</div>
									</div>
									<form action="{php echo url('wxapp/front-download/upload_verify_txt_file')}" method="post" enctype="multipart/form-data">
									<div class="modal-body">
										<div class="form-group">
											<label class="col-sm-3 control-label">上传校验文件</label>
											<div class="col-sm-9">
												<label for="fileInput" class="custom-file-upload">
													<input type="file" name="file" id="fileInput" accept=".txt">
													<i class="wi wi-upload"></i> &nbsp;&nbsp;上传文件
												</label>
												<span class="help-block txt-file"></span>
												<span class="help-block">用于在【微信公众平台-开发管理-开发设置-业务域名】页面配置业务域名时上传校验文件</span>
												<script>
													$(".custom-file-upload").on("change","input[type='file']",function(){
														$('.txt-file').text($(this).val());
													})
												</script>
											</div>
										</div>
									</div>
									<div class="modal-footer">
										<input type="hidden" name="token" value="{$_W['token']}" />
										<input type="submit" class="btn btn-primary" name="submit" value="上传">
										<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
									</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</li>
		<li class="timeline-item">
			<div class="timeline-item_tail"></div>
			<div class="timeline-item_node">2</div>
			<div class="timeline-item_wrapper">
				<div class="timeline-item_timestamp">
					上传发布
				</div>
				<div class="timeline-item_content">
					<div class="tbox">
						<div class="media media-wechat-setting">
							<div class="media-body media-middle ">
								<h4 class="media-heading color-dark">{$version_info['modules'][0]['title']}</h4>
								<div class="color-gray">版本: v{$version_info['version']}</div>
							</div>
							<div class="media-right media-middle">
								<a href="javascript:;" class="btn btn-primary" ng-click="resetUpload()">授权上传</a>
							</div>
						</div>
					</div>
					<!--上传弹框-->
					<div class="modal fade in" tabindex="-1" role="dialog" aria-hidden="false" id="upload-wxapp-modal">
						<div class="modal-dialog" role="document">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
									<div class="modal-title">小程序上传</div>
								</div>
								<div class="modal-body overflow-auto">
									<div class="modal-body we7-form wxapp-examine-self">
										<div class="panel-body">
											<div class="step we7-flex" style="padding: 0px;">
												<div class="one active">
													<span class="wi wi-one"></span>设置参数
												</div>
												<div class="arrow">
													<span class="wi wi-step-arrows"></span>
												</div>
												<div class="two" ng-class="{true:'active',false:''}[step>=2]">
													<span class="wi wi-two"></span>上传
												</div>
											</div>
										</div>
									</div>

									<div ng-show="show_step1">
										<form action="" class="we7-form" id="codeform" ng-init="user_version = '{$user_version}'; user_desc = '{$version_info['description']}'">
											<input type="hidden" name="ticket" id="ticket">
											<input type="hidden" id="version_id" value="{$version_id}">
											<div class="form-group">
												<label class="control-label col-sm-2">版本号</label>
												<div class="col-sm-10">
													<input type="text" class="form-control" id="user_version" ng-model="user_version" value="" placeholder="如：1.2.3">
													<span class="help-block">版本号仅限数字</span>
												</div>
											</div>
											<div class="form-group">
												<label class="control-label col-sm-2">版本描述</label>
												<div class="col-sm-10">
													<textarea rows="3" class="form-control" id="user_desc" ng-model="user_desc"></textarea>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-2 control-label">通用插件<a href="javascript:;" data-toggle="tooltip" data-placement="bottom" title="确认当前上传小程序在微信公众平台是否启用插件，启用请勾选是，默认不启用">
													<i class="wi wi-bangzhu"></i>
												</a></label>
												<div class="col-sm-10" style="margin-top: 6px;">
													<label class="radio-inline"><input type="radio" name="type" ng-model="usePlugin" value="1"/> 启用</label>
													<label class="radio-inline"><input type="radio" name="type" ng-model="usePlugin" value="0"/> 不启用</label>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-2 control-label">直播插件<a href="javascript:;" data-toggle="tooltip" data-placement="bottom" title="请确认当前小程序是否申请直播插件，已申请可启用该插件，默认不启用">
													<i class="wi wi-bangzhu"></i>
												</a></label>
												<div class="col-sm-10" style="margin-top: 6px;">
													<label class="radio-inline"><input type="radio" name="livePlugin" ng-model="livePlugin" value="1"/> 启用</label>
													<label class="radio-inline"><input type="radio" name="livePlugin" ng-model="livePlugin" value="0"/> 不启用</label>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-2 control-label">地理位置相关接口<a href="javascript:;" data-toggle="tooltip" data-placement="bottom" title="确认当前上传小程序是否在微信公众平台开通地理位置相关接口权限，开通请勾选是，默认不开通">
													<i class="wi wi-bangzhu"></i>
												</a></label>
												<div class="col-sm-10" style="margin-top: 6px;">
													<label class="radio-inline"><input type="radio" name="usePrivateInfo" ng-model="usePrivateInfo" value="1"/> 启用</label>
													<label class="radio-inline"><input type="radio" name="usePrivateInfo" ng-model="usePrivateInfo" value="0"/> 不启用</label>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-2 control-label">隐私保护指引<a href="javascript:;" data-toggle="tooltip" data-placement="bottom" title="仅当开发者未支持“用户隐私保护指引”时使用，重复使用会导致冲突">
													<i class="wi wi-bangzhu"></i>
												</a></label>
												<div class="col-sm-10" style="margin-top: 6px;">
													<label class="radio-inline"><input type="radio" name="privacyWindows" ng-disabled="0 == pay_status" ng-model="privacyWindows" value="1"/> 启用</label>
													<label class="radio-inline"><input type="radio" name="privacyWindows" ng-disabled="0 == pay_status" ng-model="privacyWindows" value="0"/> 不启用</label>
													<button class="btn btn-primary" type="button" ng-click="buy()" style="float: right;" ng-if="0 == pay_status">购买</button>
												</div>
											</div>
											<div class="form-group">
												<label class="col-sm-2 control-label">编译配置</label>
												<div class="1col-sm-10" style="margin-top: 6px;">
													<div style="color: #3296fa;padding-left: 121px;">
														<div ng-click="showAdvance = !showAdvance" style="width: 100px;cursor: pointer;">
															<i ng-class="{'wi wi-angle-down': !showAdvance, 'wi wi-angle-up': showAdvance}"></i>
															<span>{{showAdvance ? '收起' : '展开'}}配置</span>
														</div>
													</div>
													<div class="compileItems" ng-if="showAdvance" style="margin-left: 121px;">
														<label ng-repeat="item in minifyList" style="display:block;"><input type="checkbox" value="item.key" ng-checked="checkedMinify.indexOf(item.key) > -1" ng-click="checkeMinify(item, $index)" style="display: inline-block;margin-right: 10px;position: relative;top: 2px;" />{{item.label}}</label>
													</div>
												</div>
											</div>
											<!--
											<div class="form-group">
												<label class="control-label col-sm-2">主题样式</label>
												<div class="col-sm-10">
													<div class="form-control" id="theme" style="background-color: #eee">
														<i class="wi wi-warning-sign color-red"></i>
														<span class="color-gray">如果您的应用支持定制主题，您可以在这步设置主题</span>
														<a class="text-right pull-right link-item" href="{php echo url('wxapp/front-download/custom', array('version_id' => $version_id));}" style="color: #45a2f3;">前往设置</a>
													</div>
												</div>
											</div>
											<div class="form-group">
												<label class="control-label col-sm-2">可跳转小程序数量</label>
												<div class="col-sm-10">
													<div class="form-control" id="theme">
														<span class="color-gray">{php echo count($version_info['tominiprogram'])}个</span>
														<a class="text-right pull-right link-item" href="{php echo url('wxapp/front-download/tominiprogram', array('version_id' => $version_id));}" style="color: #45a2f3;">去添加</a>
													</div>
												</div>
											</div>
											-->
										</form>
									</div>
									<div class="wxapp-examine-self" ng-show="show_step2">
										<script type="text/javascript" src="../../../web/resource/js/lib/jquery.qrcode.min.js"></script>
										<div class="success text-center step3">
											<div ng-show="uploadState == 0">
												<span class="help-block text-center"><img src="./resource/images/loading.gif" alt="" width="45px"></span>
												<div class="status-state" style="margin-top: 10px">小程序正在上传中</div>
												<div class="help-block" style="margin-top: 30px">{{progress}}</div>
												<div class="help-block">上传过程中请勿关闭弹框</div>
											</div>
											<div ng-show="uploadState == 1">
												<div id="qrcode"></div>
												<div class="help-block">请扫描二维码进行预览</div>
												<div class="status-state">上传代码成功，请到微信开发小程序后台提交审核</div>
												<a href="javascript:openUrl('https://mp.weixin.qq.com');" style="color: #3296fa;">微信开发小程序后台：https://mp.weixin.qq.com</a>
												<div class="btns">
													{if ACCOUNT_TYPE_APP_AUTH == $_W['account']['type']}
													<a class="btn btn-primary" href="{php echo url('wxapp/front-download/platform_version_manage', array('version_id' => $version_id));}">去提交审核</a>
													{else}
													<a class="btn btn-primary" href="javascript:openUrl('https://mp.weixin.qq.com');">去提交审核</a>
													{/if}
												</div>
											</div>
											<div ng-show="uploadState == 2">
												<i class="wi wi-warning-cricle" style="color: #c7254e;"></i>
												<div class="tip">小程序上传失败</div>
												<div class="we7-help-block" style="margin-top: 30px">{{reason}}</div>
												<div class="btns">
													<button type="button" class="btn btn-default" data-dismiss="modal">关 闭</button>
												</div>
											</div>
										</div>
									</div>
								</div>
								<div class="modal-footer">
									{if ACCOUNT_TYPE_APP_AUTH == $_W['account']['type']}
									<div ng-show="show_step1">
										<button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
										<button class="btn btn-primary" type="button" ng-click="beforeUpload({$version_info['support_live']}, 'develop')">提交开发版本</button>
										<button class="btn btn btn-info we7-margin-left-sm" type="button" ng-click="beforeUpload({$version_info['support_live']}, 'audit')">提交审核版本</button>
									</div>
									{else}
									<div ng-show="show_step1">
										<button type="button" class="btn btn-default" data-dismiss="modal">取 消</button>
										<button class="btn btn-primary" type="button" id="begin-upload" ng-click="beforeUpload({$version_info['support_live']}, '')">确定并继续</button>
									</div>
									{/if}
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</li>
	</ul>
	<script>
		angular.module('we7codeuploadApp').value('config',{
			canUpload: "{$account['type']}",
			appUrl: "{$appurl}",
			privatekey: {php echo !empty($privatekey) ? json_encode($privatekey) : 'null'},
			verifyTxtFile: "{$verify_txt_file}",
			accountType: "{$account['type']}",
			version_id: "{$version_id}",
			pay_status: "{$pay_status}",
			upgrade_url: "{php echo url('wxapp/front-download/upgrade_module')}",
			links: {
				setAppUrl: "{php echo url('wxapp/front-download/set_appurl')}",
				setPrivateKey: "{php echo url('wxapp/front-download/upload_private_key')}",
				commitCode: "{php echo url('miniapp/platform-version/commit')}",
				publishBuy: "{php echo url('wxapp/front-download/publish_buy')}",
			}
		});

		angular.bootstrap($('#wxapp-upload'), ['we7codeuploadApp']);
	</script>
	{/if}
{/if}

{if $do == 'tominiprogram'}
<div id="tominiprogram" ng-controller="tominiprogram" ng-cloak>
	<div class="alert alert-info we7-page-alert">
		<p><i class="wi wi-info-sign"></i>最多可添加10个跳转小程序</p>
	</div>
	<div class="pull-right clearfix we7-margin-bottom search-box">
		<a href="javascript:;" class="btn btn-primary" ng-click="showForm(1)">添加</a>
	</div>
	<table class="table we7-table table-manage vertical-middle" id="js-users-display">
		<col width="150px">
		<col width="">
		<col width="">
		<col width="170px">
		<tr>
			<th>序号</th>
			<th class="text-center">APPID</th>
			<th class="text-center">小程序名称</th>
			<th class="text-right">操作</th>
		</tr>
		<tr ng-repeat="item in tomini_lists">
			<td ng-init="p_index=$index">{{p_index + 1}}</td>
			<td class="color-default text-center">{{item.appid}}</td>
			<td class="color-default text-center">{{item.app_name}}</td>
			<td class="" style="border-left: 1px solid #ddd;" ng-if="p_index == 0" rowspan="{{tomini_lists.length}}">
				<div class="link-group">
					<a href="javascript:;" ng-click="showForm(0)">编辑</a>
				</div>
			</td>
		</tr>
		<tr ng-if="tomini_lists | we7IsEmpty">
			<td colspan="4" class="text-center">暂无数据</td>
		</tr>
	</table>
	<div class="modal fade" id="addminiprogram" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="we7-modal-dialog modal-dialog we7-form">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
					<div class="modal-title">{{is_add ? '添加' : '编辑'}}可跳转小程序</div>
				</div>
				<form action="" method="post">
					<input type="hidden" name="c" value="wxapp">
					<input type="hidden" name="a" value="front-download">
					<input type="hidden" name="do" value="tominiprogram">
					<input type="hidden" name="version_id" value="{$version_id}">
					<input type="hidden" name="is_add" value="{{is_add}}">
					<input type="hidden" name="token" value="{$_W['token']}">
					<div class="modal-body overflow-auto">
						<div class="alert alert-info we7-page-alert" ng-show="is_add">
							<p><i class="wi wi-info-sign"></i>历史添加{{tomini_lists.length}}个，还可添加<span class="color-default">{{max_count - tomini_lists.length}}</span>个</p>
						</div>
						<div class="row" ng-repeat="item in edit_list">
							<div class="form-group col-sm-6 " style="margin-bottom: 20px;">
								<input type="text" name="appid[]" ng-model="item.appid" class="form-control" placeholder="小程序APPID">
							</div>
							<div class="form-group col-sm-6 " style="margin-bottom: 20px;">
								<input type="text" name="app_name[]" ng-model="item.app_name" class="form-control" placeholder="小程序名称">
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="submit" class="btn btn-primary" name="submit" value="submit">确定</button>
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	angular.module('wxApp').value('config',{
		'tomini_lists' : {php echo json_encode(array_values($tomini_lists))},
		'max_count': 10
	});
	angular.bootstrap($('#tominiprogram'), ['wxApp']);
</script>
{/if}

{if $do == 'platform_version_manage'}
<div id="wxappversion" ng-cloak ng-controller="wxappVersion">
	<div class="search-box we7-margin-bottom">
		<div class="search-form"></div>
		<a href="{php echo url('wxapp/front-download', array('version_id' => $version_id))}" class="btn btn-primary we7-padding-horizontal">发布小程序</a>
	</div>
	<table class="table we7-table table-hover vertical-middle" >
		<col width="240">
		<col>
		<col width="240">
		<tr>
			<th colspan="4" class="text-left">线上版本</th>
		</tr>
		<tr ng-if="platform_version_info.success" ng-repeat="item in platform_version_info.success">
			<td class="wxapp-version-version">
				<div class="color-gray">版本号</div>
				<div class="version">{{item.version}}</div>
			</td>
			<td class="wxapp-version-desc">
				<p><span class="color-gray">开发者</span> {{item.developer}}</p>
				<p><span class="color-gray">提交审核时间</span> {{item.upload_time}}</p>
				<p><span class="color-gray">描述</span>  {{item.description}}</p>
			</td>
			<td>
				<div class="link-group">
					<a href="javascript:;" ng-click="revert(item)">退回版本</a>
				</div>
			</td>
		</tr>
		<tr ng-show="!platform_version_info.success">
			<td colspan="100">
				<div class="we7-empty-block">
					尚未提交线上版本
				</div>
			</td>
		</tr>
	</table>
	<table class="table we7-table table-hover vertical-middle" >
		<col width="240">
		<col>
		<col width="240">
		<tr>
			<th colspan="4" class="text-left">审核版本</th>
		</tr>
		<tr ng-if="platform_version_info.audit" ng-repeat="item in platform_version_info.audit">
			<td class="wxapp-version-version">
				<div class="color-gray">版本号</div>
				<div class="version">{{item.version}}</div>
				<span class="alert alert-danger" ng-if="item.status == 1">已拒绝</span>
				<span class="alert alert-warning" ng-if="item.status == 2">审核中</span>
				<span class="alert alert-success" ng-if="item.status == 5">已通过</span>
			</td>
			<td class="wxapp-version-desc">
				<p><span class="color-gray">开发者</span> {{item.developer}}</p>
				<p><span class="color-gray">提交审核时间</span> {{item.upload_time}}</p>
				<p><span class="color-gray">描述</span>  {{item.description}}</p>
			</td>
			<td>
				<div class="link-group">
					<a href="javascript:;" class="color-red" ng-click="showReason(item)" ng-if="item.status == 1 && item.reason && item.reason.length">拒绝原因</a>
					<a href="javascript:;" ng-click="delete(item)" ng-if="item.status == 1">删除审核</a>
					<a href="javascript:;" ng-click="undo(item)" ng-if="item.status == 2">
						撤回审核
						<i data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="<div class='color-gray' style='width: 260px;'>当日可撤销审核<span class='color-red'>{{item.day_num}}</span>次，当月还可以撤销<span class='color-red'>{{item.month_num}}</span>次</div>" data-html="true" class="wi wi-info"></i>
					</a>
					<a href="javascript:;" ng-click="release(item)" ng-if="item.status == 5">发布版本</a>
				</div>
			</td>
		</tr>
		<tr ng-show="!platform_version_info.audit">
			<td colspan="100">
				<div class="we7-empty-block">
					您暂无提交审核的版本或版本已发布上线
				</div>
			</td>
		</tr>
	</table>
	<table class="table we7-table table-hover vertical-middle" >
		<col width="240">
		<col>
		<col width="240">
		<tr>
			<th colspan="4" class="text-left">开发版本</th>
		</tr>
		<tr ng-if="platform_version_info.develop" ng-repeat="item in platform_version_info.develop">
			<td class="wxapp-version-version">
				<div class="color-gray">版本号</div>
				<div class="version">{{item.version}}</div>
				<a href="javascript:;" class="alert alert-success" ng-if="item.status == 0" ng-click="showQr(item)"><i class="wi wi-erweima"></i>扫码预览</a>
			</td>
			<td class="wxapp-version-desc">
				<p><span class="color-gray">开发者</span> {{item.developer}}</p>
				<p><span class="color-gray">提交审核时间</span> {{item.upload_time}}</p>
				<p><span class="color-gray">描述</span>  {{item.description}}</p>
			</td>
			<td>
				<div class="link-group">
					<a href="javascript:;" ng-click="submitAudit(item)">提交审核</a>
				</div>
			</td>
		</tr>
		<tr ng-show="!platform_version_info.develop">
			<td colspan="100">
				<div class="we7-empty-block">
					您尚未上传任何开发版本，<a href="{php echo url('wxapp/front-download')}">立即发布</a>
				</div>
			</td>
		</tr>
	</table>
	<div class="modal fade" id="qrCodeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">微信扫码预览小程序</h4>
				</div>
				<div class="modal-body text-center">
					<img class="qr-img" style="max-height: 130px;" ng-src="{{preview_qrcode}}" >
				</div>
			</div>
		</div>
	</div>
	<div class="modal fade" id="reasonModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">拒绝原因</h4>
				</div>
				<div class="modal-body text-center">
					<div ng-bind-html="reason"></div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	angular.module('wxApp').value('config', {
		'platform_version_info': {php echo json_encode($platform_version_info)},
		qrcodeUrl: "{php echo url('miniapp/platform-version/get_qrcode')}",
		submitAuditUrl: "{php echo url('miniapp/platform-version/submit_audit')}",
		releaseUrl: "{php echo url('miniapp/platform-version/release')}",
		undoUrl: "{php echo url('miniapp/platform-version/undo_code_audit')}",
		deleteUrl: "{php echo url('miniapp/platform-version/delete_audit')}",
		revertUrl: "{php echo url('miniapp/platform-version/revert_code_release')}"
	});
	angular.bootstrap($('#wxappversion'), ['wxApp']);
</script>
{/if}
{template 'common/footer'}
